package com.oygo.hunter.keep;

import android.app.NotificationChannel;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.os.Build;

import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;

import com.oygo.hunter.BaseApplication;
import com.oygo.hunter.R;
import com.oygo.hunter.decode.DecodeWrapper;

public class KeepImpl implements IKeepLive {


    public static final String notiFlag = DecodeWrapper.package_decode1("YG3C7s3PoV4RaQBN9CW+9GkZvr+tqA4ACGZnjTie3q4=");


    @Override
    public NotificationCompat.Builder createNotyfiBuilder(Context context) {
        NotificationCompat.Builder v0 = Build.VERSION.SDK_INT < 26 ? new NotificationCompat.Builder(BaseApplication.getInstance(), null) : new NotificationCompat.Builder(BaseApplication.getInstance(), this.ikeep_package(context));
        v0.setContentTitle("手机优化中");
        v0.setContentText("正在优化您的手机");
        v0.setSmallIcon(R.mipmap.ic_launcher);  // drawable:icon_top_0
        v0.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher));  // drawable:icon_top_0
        v0.setAutoCancel(true);
        v0.setDefaults(4);
        v0.setPriority(-1);
        return v0;
    }

    @Override
    public void ikeep_float() {

    }

    @Override
    public void ikeep_float(boolean arg1) {

    }

    /**
     * Wallpaper 保活
     * @return
     */
    @Override
    public int ikeep_package() {
        return R.mipmap.ic_launcher;
    }

    @RequiresApi(api = Build.VERSION_CODES.O)
    @Override
    public String ikeep_package(Context arg1) {
        NotificationManagerCompat v4 = NotificationManagerCompat.from(arg1);
        NotificationChannel v1 = new NotificationChannel(KeepImpl.notiFlag, KeepImpl.notiFlag, 4);
        v1.enableLights(false);
        v1.setShowBadge(false);
        v1.enableVibration(false);
        v1.setSound(null, null);
        v4.createNotificationChannel(v1);
        return v1.getId();
    }

    @Override
    public void ikeep_package(boolean arg1) {

    }

    /**
     * 账号同步保活
     * @return
     */

    @Override
    public String ikeep_private() {
        return "Strong";
    }

    @Override
    public void ikeep_throws() {

    }

    /**
     * 账号同步保活
     * @return
     */

    @Override
    public String ikeep_volatile() {
        return "scet.strong.clean.ex.t.sync.account";
    }
}
